using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data {
	public partial class RefundOrderMap
		: System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<RefundOrder> {
		public RefundOrderMap() {
			// table
			ToTable("mc_RefundOrder", "dbo");

			// keys
			HasKey(t => t.Id);

			// Properties
			Property(t => t.Id)
				.HasColumnName("Id")
				.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
				.IsRequired();
			Property(t => t.OrderNo)
				.HasColumnName("OrderNo")
				.HasMaxLength(50)
				.IsRequired();
			Property(t => t.OrderId)
				.HasColumnName("OrderId")
				.IsRequired();
			Property(t => t.Amount)
				.HasColumnName("Amount")
				.HasPrecision(18, 2)
				.IsRequired();
			Property(t => t.ApplyTime)
				.HasColumnName("ApplyTime")
				.IsRequired();
			Property(t => t.Status)
				.HasColumnName("Status")
				.IsRequired();
			Property(t => t.PayId)
				.HasColumnName("PayId")
				.IsOptional();
			Property(t => t.RefundTime)
				.HasColumnName("RefundTime")
				.IsOptional();

			// Relationships
			HasRequired(t => t.Order)
				.WithMany()
				.HasForeignKey(d => d.OrderId)
				.WillCascadeOnDelete(false);
			HasOptional(t => t.PayInfo)
				.WithMany()
				.HasForeignKey(d => d.PayId)
				.WillCascadeOnDelete(false);
		}
	}
}
